﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="AllUsers.aspx.vb" Inherits="Training.AllUsers" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Training - Training:: All Users</title>
<link rel="Stylesheet" type="text/css" media="screen" href="../css/adminStyle.css" />
</head>
<body>
    <form id="form1" runat="server">
    <div class="ctr">
        <h2>All Membership Users</h2>
        
        <div style="width:80%;text-align:left;margin:0 auto;" class="text">
            <p>
            This screen allows you to view the locked out / active / role status of users and
            modify the settings as needed.</p>
        <p>
            (<em>A user is locked out if they enter a certain number of invalid passwords in a row
                (the default being 5); a user can then be unlocked by calling the <span style="font-family: Courier New">
                    MembershipUser</span> class's <span style="font-family: Courier New">UnlockUser()</span>
                method</em>)</p>
        <p>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
                DataSourceID="UsersInfoDataSource" ForeColor="#333333" 
                DataKeyNames="UserName" AllowPaging="True" PageSize="25" Width="100%">
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" 
                    Width="100%" />
                <Columns>
                    <asp:BoundField DataField="UserName" HeaderText="User" ReadOnly="True" SortExpression="UserName" />
                    <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                    <asp:TemplateField HeaderText="Approved?">
                        <ItemTemplate>
                            <asp:CheckBox runat="server" OnCheckedChanged="ToggleApproved" AutoPostBack="True" ID="IsApproved" Checked='<%# Eval("IsApproved") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Locked Out?">
                        <ItemTemplate>
                            <asp:CheckBox runat="server" Enabled="False" ID="IsLockedOut" Checked='<%# Eval("IsLockedOut") %>' />
                            
                            <%-- This LinkButton is only shown if the user is locked out --%>
                            <asp:LinkButton ID="LinkButton1" runat="server" CommandName="UnlockUser" Visible='<%# Eval("IsLockedOut") %>'>Unlock</asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Administrator?">
                        <ItemTemplate>
                            <asp:CheckBox runat="server" OnCheckedChanged="ToggleAdministrator" AutoPostBack="True" ID="IsAdministrator" Checked='<%# Roles.IsUserInRole(Eval("UserName").ToString(), "Administrator") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <RowStyle BackColor="#EFF3FB" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#2461BF" />
                <AlternatingRowStyle BackColor="White" />
            </asp:GridView>
            <asp:ObjectDataSource ID="UsersInfoDataSource" runat="server" SelectMethod="GetAllUsers"
                TypeName="System.Web.Security.Membership"></asp:ObjectDataSource>
        </p>
        </div>
        
        <br />
        <p><a href="Default.aspx">Admin Main</a></p>
    </div>
    </form>
</body>
</html>
